//package ajax;
//
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import ajax.Student;
//
//import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//@WebServlet("/login.do")
//public class LoginController extends HttpServlet {
//    @Override
//    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
//            throws ServletException, IOException {
//        resp.setContentType("application/json;charset=utf-8");
//        Student student = new Student();
//        student.setUsername(req.getParameter("username"));
//        student.setPassword(req.getParameter("password"));
//        JSONObject json = new JSONObject();
//        String  result = null;
//        try {
//            result = JDBCLogin.query(student);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        if("登录成功".equals(result)){
//            json.put("status", "success");
//        }else {
//            json.put("status", "error");
//        }
//        //响应数据给浏览器
//        resp.getWriter().write(JSON.toJSONString(json));
//        //req.getRequestDispatcher("/login_Result.jsp").forward(req,resp);
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        doGet(req,resp);
//    }
//}